package slim3.controller.member.todo;

import java.util.logging.Logger;
import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import slim3.dao.CategoryDao;
import slim3.dao.TaskDao;
import slim3.model.Task;

public class SearchController extends Controller {

    @SuppressWarnings("unused")
    private static final Logger logger = Logger.getLogger(SearchController.class.getName());

    private TaskDao dao = new TaskDao();
    private CategoryDao categoryDao = new CategoryDao();
    
    @Override
    public Navigation run() {
        Task t = dao.find(key());
        if (t.getCategoryKey() != null) {
            t.setCategory(categoryDao.find(t.getCategoryKey()));
        }
        requestScope("json", t);
        return forward("/json/encode.jsp");
    }
}
